package exam.test.mapper;

import org.apache.catalina.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    //查询全部用户信息
    @Select("select * from user")
    public List<User> list();

    //根据id删除数据
    @Delete("delete from user where id=#{id}")
    public void delete(Integer id);

    //插入用户信息
    @Options(useGeneratedKeys = true,keyProperty = "id")//主键返回
    @Insert("insert into user(name) values(#{name})")
    public void insert(User user);

    //更新信息
    @Update("update user set name=#{name} where id=#{id}")
    public void update(User user);


}

